[##include file="common/header.tpl.php"##]
[##include file="common/nav.tpl.php"##]
<div id="main">    
  <form id="lucky_form" method="post">
    <table class=gridView>
  <thead>
  <tr>
    <td>姓名</td>
    <td>性别</td>
    <td>日期</td>
    <td>手机验证</td>
    <td>抽中</td>
  </tr>
  </thead>
  [##section name=list loop=$draw##]
  <tr id="dle_[##$draw[list].time##]">
    <td>[##$draw[list].name##] </td>
    <td>[##if $draw[list].sex==1##][男][##else##][女	][##/if##]</td>
    <td>[##$draw[list].time|formatTime:'day'##]</td>
    <td>
    [##if $draw[list].proving==0##]未验证[##else##]已验证	[##/if##]
    </td>
    <td><input type="checkbox" name="checkbox[]" value="[##$draw[list].time##]" checked="checked"/></td>
  </tr>
 [##/section##]
  <tr>
    <td colspan="5">
    [##if $draw##]
    <input type="submit" id="rand_submit" value="随机抽取"/>
    &nbsp;&nbsp;&nbsp;
    <input type="button" id="lucky_submit" value="确认抽奖" />&nbsp;&nbsp;&nbsp;
    [##else##]
    暂无信息
    [##/if##]
    </td>
  </tr>
</table>
    <br />
  </form></div>
<script type="text/javascript">
// 绑定表单提交事件
$('#rand_submit').click(function() {
	var submit_url = '[##$adminurl##]/?m=telephone&a=lucky';
	$.post(submit_url , $('#lucky_form').serialize() , function(d) {
		if(d.code) return alert(d.msg);
		alert(d.msg);
	} , 'json');

});
// 绑定表单提交事件
$('#lucky_submit').click(function() {
	var submit_url = '[##$adminurl##]/?m=telephone&a=openlucky';
	$.post(submit_url , $('#lucky_form').serialize() , function(d) {
		if(d.code) return alert(d.msg);
		alert(d.msg);
		
		var id = d.result;
		//ids = ids.split(',');
		var length = id.length;
		var i = 0;
		for(i ; i < length ; i++){
			$('#dle_' + id).remove();
		}
		// alert(id);
		//for
		//$('#dle_' + id).remove()
		// window.location.href = '[##$adminurl##]/?m=telephone&a=lucky';
	} , 'json');

});
</script>
[##include file="common/footer.tpl.php"##]

